A Software Engineer Learns HTML5, JavaScript and jQuery: A guide to standards-based web applications by Dane Cameron

A Software Engineer Learns HTML5, JavaScript and jQuery: A guide to standards-based web applications by Dane Cameron

Author:Dane Cameron
Language: eng
Format: mobi, azw3, epub, pdf
Publisher: Cisdal Publishing
Published: 2013-10-29T23:00:00+00:00


Another very useful feature of the debugger is the pause button at the bottom of the menu:

If you click this once it will turn blue. This will cause the debugger to automatically pause on any exception – including handled exceptions.

If you click it once more it will turn purple. This will cause the debugger to automatically pause on all unhandled exceptions. This is very useful, since it is not always obvious that a JavaScript error has occurred. As long as this setting is in place, and you always run the application with the development tools open, you will not miss any errors, and will be able to debug them while they are occurring.

In order to see this in action, remove the existing breakpoint, and change the code:

$('#btnAddTask').click(function(evt) {

evt.preventDefault();

$('#taskCreation').removeClass('not');

});

to

$('#btnAddTask').click(function(evt) {

evt.callUnknownFunction();

$('#taskCreation').removeClass('not');

});

Since JavaScript is not a type checked language, it is not until run-time that an exception will be caused by this line. If you now refresh the screen and click the “Add task” button you will see that the debugger automatically stops on this line:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.